package com.yao.mssm.system.crossDatabase.impl;

import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.yao.mssm.system.crossDatabase.ICDUserService;
import com.yao.mssm.system.entity.Employee;
import com.yao.mssm.system.entity.User;
import com.yao.mssm.system.service.IEmpService;
import com.yao.mssm.system.service.ISysUserService;
@Service
public class CDUserService implements ICDUserService{
	
	@Autowired
	IEmpService empService;
	
	@Autowired
	ISysUserService sysUserService;

	@Override
	public boolean saveUser() {
		
		Employee emp = new Employee();
		emp.setBirthday(new Date());
		emp.setName("测试多数据源事务");
		
		User user = new User();
		user.setAccount("测试多数据源事务");
		user.setCreateTime(new Date());
		user.setPassword("123456");
		empService.insert(emp);
		sysUserService.insert(user);
		
		//int i = 1/0;
		
		return true;
	}

}
